﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MastePage/SubEmptyMaster.Master" AutoEventWireup="true" CodeBehind="ProductEdit.aspx.cs" Inherits="BySoft.Web.Site.MasteData.ProductEdit" %>

<%@ MasterType VirtualPath="~/MastePage/SubEmptyMaster.master" %>
<%@ Register Assembly="OneSoft.Web" Namespace="OneSoft.Web.UI.WebControls" TagPrefix="asp" %>
<%@ Register Assembly="BySoft.Web.Controls" Namespace="BySoft.Web.Controls" TagPrefix="cc1" %>
<asp:Content ID="cphHeadContent" runat="server" ContentPlaceHolderID="HeadPlace">
    <script type="text/javascript">

        $(function () {
            $("#tabs").tabs({ show: function (event, ui) { iframeAutoFit(); } });
        })
        function Refreashtab() {
            $("#tabs").tabs({ show: function (event, ui) { iframeAutoFit(); } });
        }
        function CheckNumWithDotOne(txtBox) {
            if (txtBox != null && txtBox.value != "") {
                var numFormat = /(^[0-9]\d{0,9}(\.\d{0,2})?$)/;
                var text = txtBox.value;
                if (!numFormat.test(text)) {
                    txtBox.value = 0;
                }
            }
        }



        function FunAddProductFile(strId) {
            ShowTopDialog('添加文件', '../ComPage/UpProductFilePage.aspx?id=' + strId, 'FillProductFile(' + strId + ');', 500, 200); return false;
        }
        function FillProductFile(strId) {
            var str = getCookie(dialogReturn_key);
            if (str != null && str == "success") {

                if (strId == '5') {
                    //上传图纸
                    $("#<%=btnAddMapFileHide.ClientID %>").click();

                } else {
                    //上传技术文件
                    $("#<%=btnAddTechFileHide.ClientID %>").click();

                }



            }
            setCookie(dialogReturn_key, "");
            iframeAutoFit();
        }

    </script>
</asp:Content>
<asp:Content ID="cphContent" runat="server" ContentPlaceHolderID="EmptyMasteCPH">
    <h1 class="tit">基础资料 >> <a href="ProductList.aspx">产品资料>></a> 编辑</h1>
    <br />
    <div class="tableStyle2">
        <table border="0" cellspacing="0" cellpadding="0" style="text-align: left; width: 100%"
            id="tBase" runat="server">
            <tr>
                <th class="left2">产品类型：
                </th>
                <td class="right2">
                    <asp:DropDownList ID="ddlProductType" runat="server" Enabled="false" Width="90%"></asp:DropDownList>
                </td>
                <th class="left2">产品编号：
                </th>
                <td class="right2">
                    <asp:Label CssClass="lblreadonly" ID="lblProductID" runat="server"></asp:Label>
                </td>
            </tr>
            <tr>
                <th class="left2"></th>
                <td class="right2"></td>
                <th class="left2">客户零件号：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtCustomerPartNo" runat="server"></asp:TextBox>

                </td>

            </tr>
            <tr>
                <th class="left2">产品名称：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtProductName" runat="server"></asp:TextBox>
                    <span style="color: Red">*</span>
                    <asp:RequiredFieldValidator ControlToValidate="txtProductName" Display="None" ErrorMessage="请输入产品名称！" ID="rgvProductName"
                        ValidationGroup="gSubmit" runat="server"></asp:RequiredFieldValidator>
                </td>
                <th class="left2">规格：
                </th>
                <td class="right2">
                    <asp:TextBox ID="txtSpecifications" CssClass="fullWidth" runat="server"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <th class="left2">外径(mm)：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtOutSide" runat="server"></asp:TextBox>
                    <span style="color: Red">*</span>
                    <asp:RequiredFieldValidator ControlToValidate="txtOutSide" Display="None" ErrorMessage="请输入产品外径！" ID="RequiredFieldValidator1"
                        ValidationGroup="gSubmit" runat="server"></asp:RequiredFieldValidator>

                    <asp:RegularExpressionValidator ControlToValidate="txtOutSide" Display="None" ErrorMessage="外径最大为4码" ID="revOutSide"
                        ValidationExpression="\d{0,4}" ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>


                </td>
                <th class="left2">内径(mm)：
                </th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtInSide" runat="server"></asp:TextBox>
                    <span style="color: Red">*</span>
                    <asp:RequiredFieldValidator ControlToValidate="txtInSide" Display="None" ErrorMessage="请输入产品内径！" ID="RequiredFieldValidator3"
                        ValidationGroup="gSubmit" runat="server"></asp:RequiredFieldValidator>

                    <asp:RegularExpressionValidator ControlToValidate="txtInSide" Display="None" ErrorMessage="内径最大为4码" ID="revInSide"
                        ValidationExpression="\d{0,4}" ValidationGroup="gSubmit" runat="server"></asp:RegularExpressionValidator>
                </td>
            </tr>

            <tr>
                <th class="left2">单位：</th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtUnit" runat="server"></asp:TextBox></td>
                <th class="left2">安全库存量：</th>
                <td class="right2">
                    <asp:TextBox CssClass="fullWidth" ID="txtSafeStock" runat="server" onkeyup="CheckNumWithDotOne(this)"></asp:TextBox></td>
            </tr>

        </table>
    </div>
    <div class="tableStyle">
        <div id="tabs">
            <ul>
                <li><a href="#tabs-1">图纸附件</a></li>
                <li><a href="#tabs-2">技术文件附件</a></li>
            </ul>
            <div id="tabs-1" class="tableStyle" style="padding-bottom: 10px;">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>



                        <div style="width: 100%; padding-bottom: 10px">
                            <div align="right">
                                <label class="btnStylec png_bg">
                                    <asp:Button ID="btnAddMapFile" runat="server" Text="新增" OnClientClick="FunAddProductFile(5)" />
                                    <asp:Button ID="btnAddMapFileHide" runat="server" Text="添加" CssClass="Hidden" OnClick="btnAddMapFileHide_Click" />
                                </label>

                            </div>
                        </div>


                        <div>
                            <asp:SGridView runat="server" ID="grdResultMap" Width="100%" ShowActionToolBar="false"
                                AutoGenerateColumns="false" AllowCascade="false" OnRowDataBound="grdResult_RowDataBound" OnRowCommand="grdResultMap_RowCommand">
                                <Columns>
                                    <asp:TemplateField HeaderText="AttachmentID" ItemStyle-CssClass="Hidden" FooterStyle-CssClass="Hidden" HeaderStyle-CssClass="Hidden">
                                        <ItemTemplate>
                                            <asp:Label ID="lblAttachmentID" Text='<%#Eval("AttachmentID") %>' runat="server"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="序号">
                                        <ItemTemplate>
                                            <%# Container.DisplayIndex+1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="上传日期">
                                        <ItemTemplate>
                                            <asp:Label ID="lblUpDateTime" Text='<%#Eval("UpDateTime") %>' runat="server"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="文件名">
                                        <ItemTemplate>
                                            <a href='<%#Eval("OpenURL") %>' target="_blank">
                                                <asp:Label ID="lblFileName" Text='<%#Eval("FileName") %>' runat="server" ToolTip="点击查看文件"></asp:Label>
                                            </a>
                                        </ItemTemplate>
                                    </asp:TemplateField>



                                    <asp:TemplateField>
                                        <HeaderStyle Width="35px" />
                                        <HeaderTemplate>
                                            删除
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:ImageButton ImageUrl="../App_Themes/Common_CSS/images/delete_small.gif" runat="server"
                                                ID="ibtnDel" />
                                            <asp:Button ID="btnDel" runat="server" CssClass="Hidden" CommandArgument='<%#Eval("AttachmentID") %>'
                                                CommandName="del" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                </Columns>
                            </asp:SGridView>



                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
            <div id="tabs-2" class="tableStyle" style="padding-bottom: 10px; margin-bottom: 0px;">

                <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                    <ContentTemplate>
                        <div style="text-align: right; width: 100%; padding-bottom: 10px">
                            <label class="btnStylec png_bg">
                                <asp:Button ID="btnAddTechFile" runat="server" Text="新增" OnClientClick="FunAddProductFile(6)" />
                                <asp:Button ID="btnAddTechFileHide" runat="server" Text="添加" CssClass="Hidden" OnClick="btnAddTechFileHide_Click" />
                            </label>


                        </div>
                        <div style="padding-bottom: 0px;">
                            <asp:SGridView runat="server" ID="grdResultTech" Width="100%" ShowActionToolBar="false"
                                AutoGenerateColumns="false" AllowCascade="false" OnRowDataBound="grdResult_RowDataBound" OnRowCommand="grdResultTech_RowCommand">
                                <Columns>
                                    <asp:TemplateField HeaderText="AttachmentID" ItemStyle-CssClass="Hidden" FooterStyle-CssClass="Hidden" HeaderStyle-CssClass="Hidden">
                                        <ItemTemplate>
                                            <asp:Label ID="lblAttachmentID" Text='<%#Eval("AttachmentID") %>' runat="server"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="序号">
                                        <ItemTemplate>
                                            <%# Container.DisplayIndex+1 %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="上传日期">
                                        <ItemTemplate>
                                            <asp:Label ID="lblUpDateTime" Text='<%#Eval("UpDateTime") %>' runat="server"></asp:Label>
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                    <asp:TemplateField HeaderText="文件名">
                                        <ItemTemplate>
                                            <a href='<%#Eval("OpenURL") %>' target="_blank">
                                                <asp:Label ID="lblFileName" Text='<%#Eval("FileName") %>' runat="server" ToolTip="点击查看文件"></asp:Label>
                                            </a>
                                        </ItemTemplate>
                                    </asp:TemplateField>



                                    <asp:TemplateField>
                                        <HeaderStyle Width="35px" />
                                        <HeaderTemplate>
                                            删除
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <asp:ImageButton ImageUrl="../App_Themes/Common_CSS/images/delete_small.gif" runat="server"
                                                ID="ibtnDel" />
                                            <asp:Button ID="btnDel" runat="server" CssClass="Hidden" CommandArgument='<%#Eval("AttachmentID") %>'
                                                CommandName="del" />
                                        </ItemTemplate>
                                    </asp:TemplateField>

                                </Columns>
                            </asp:SGridView>



                        </div>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </div>
        </div>
    </div>
    <div class="controlBar" align="center">
        <table cellpadding="0" cellspacing="0" style="width: 300px; margin: 0 auto;">
            <tr>
                <td colspan="4">
                    <label class="btnStyleb png_bg">
                        <asp:Button ID="btnSubmit" runat="server" Text="确定" OnClick="btnSubmit_Click" ValidationGroup="gSubmit"
                            class="png_bg" />
                    </label>
                    <label class="btnStylec png_bg">
                        <input type="button" id="Button2" value="返回" runat="server" onclick="window.location = 'ProductList.aspx'"
                            class="png_bg" />
                    </label>
                </td>
            </tr>
        </table>
    </div>
</asp:Content>


